<?php
/*
Template Name: Spriggan
*/

function includeCss(){
    $templatePath = "http://www.crabula.com/wp-content/themes/blogtxt";
    echo "<link rel='stylesheet' type='text/css' href='$templatePath/spriggan.css' />";
}
add_action('wp_head', includeCss);

?>
<?php get_header() ?>


<div class="hfeed">

<h2>Here are some of my favorite RSS Feeds!</h2>
What do you think of my fancy php skills? <br>

<?php 
    $paths = explode(PATH_SEPARATOR, get_include_path());
    $path = ABSPATH;
       
    if (array_search($path, $paths) === false){
	array_push($paths, $path);
    }
    set_include_path(implode(PATH_SEPARATOR, $paths));

    require_once 'spriggan-rss.php'; 
    echo(fetchRss());
?>

<?php if(is_user_logged_in()): ?>
    <div id='addFeed'> You are logged in. 
        <form id="add-feed-form" method="post" action="/my-rss/?method=add">
        <input type="hidden" name="feed-method-add" value="Y">
        <input type="text" name="feed-url" value="Feed URL" />
        <input type="text" name="feed-shortName" value="Feed Short Name" />
	<div> Type:  
	  <select name="feed-type">
	    <option value ="normal">Normal Blog</option>
	    <option value ="image">Image Blog</option>
	    <option value ="news">News Blog</option>
	    <option value ="custom">Custom Blog</option>
	  </select>
	</div>

        <input type="submit" name="Submit" value="Add Feed" />
        </form>
    </div>
    <div id='clear-feeds-form' style='margin-top: 1em'>
        <form id="clear-feed-form" method="post" action="/my-rss/?method=clear">
        <input type="hidden" name="feed-method-clear" value="Y">
        <input type="submit" name="Submit" value="Clear Feeds" />
        </form>
    </div>
    <div id='reset-feeds-form' style='margin-top: 1em'>
        <form id="reset-feed-form" method="post" action="/my-rss/?method=reset">
        <input type="hidden" name="reset-method-clear" value="Y">
        <input type="submit" name="Submit" value="Reset Feeds" />
        </form>
    </div>
<?php endif; ?> 


</div>

</div><!-- #content -->
</div><!-- #container -->

<?php get_sidebar() ?>
<?php get_footer() ?>
